﻿var map;
var ctaLayer;
var beachMarker;

function google_initialize(lat, lng) {
    var image = 'icon/bus5.png';
    var latlng = new google.maps.LatLng(lat,lng);
    var myOptions = {
        zoom: 11,
        mapTypeControl: false,
        panControl: false,
        scaleControl: false,
        streetViewControl: false,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
    map.setCenter(latlng);
    beachMarker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: image
    });
    //ctaLayer = new google.maps.KmlLayer(SERVER_ADDRESS+'getlistkml.php?stopid='+stopid+'&random=' + Math.random(), { preserveViewport: true });
    //ctaLayer.setMap(map);
    map.setZoom(16);
    map.setCenter(latlng);
}
function google_initialize2(lat, lng,ico) {
    var image = 'icon/' + ico + '.png';
    var latlng = new google.maps.LatLng(lat, lng);
    var myOptions = {
        zoom: 11,
        mapTypeControl: false,
        panControl: false,
        scaleControl: false,
        streetViewControl: false,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_detail_canvas"), myOptions);
    map.setCenter(latlng);
    beachMarker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: image
    });
    
    latlng = new google.maps.LatLng(StopData.lat, StopData.lng);
    beachMarker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: "icon/bus5.png"
    });

    //ctaLayer = new google.maps.KmlLayer(SERVER_ADDRESS+'getlistkml.php?stopid='+stopid+'&random=' + Math.random(), { preserveViewport: true });
    //ctaLayer.setMap(map);
    map.setZoom(16);
    //map.setCenter(latlng);
}
function AddMarker(lat, lng, ico) {
    var image = 'icon/' + ico + '.png';
    var latlng = new google.maps.LatLng(lat, lng);
    beachMarker = null;
    beachMarker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: image
    });
    beachMarker.setMap(map);
    beachMarker.setAnimation(google.maps.Animation.BOUNCE);
}